<template>
	<view class="pay-success" v-if="!loadding" :class="theme() || ''" :data-theme='theme()'>
		<view class="success-icon d-c-c d-c">
			<text class="iconfont icon-queren theme-btn"></text>
			<text class="name">支付成功</text>
		</view>
		<view class="success-price d-c-c">
			￥<text class="num">{{detail.pay_price}}</text>
		</view>
		<view class="order-info mt30 f28" v-if="detail.points_bonus > 0">
			<view class="d-b-c p20 border-t">
				<text class="dominant icon iconfont icon-jifen1"></text>
				<text class="gray3 flex-1">{{points_name()}}</text>
				<text class="gray3">{{detail.points_bonus}}</text>
			</view>
		</view>
		<view class="success-btns d-b-c">
			<button class="flex-1 mr10 theme-borderbtn" @click="goHome()">返回首页</button>
			<button class="flex-1 ml10 theme-btn" @click="goMyorder">我的订单</button>
		</view>
		<!--推荐-->
		<view>
			<recommendProduct :location="30"></recommendProduct>
		</view>
	</view>
</template>

<script>
	import recommendProduct from '@/components/recommendProduct/recommendProduct.vue';
	export default {
		components: {
			recommendProduct
		},
		data() {
			return {
				/*是否加载完成*/
				loadding: true,
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				/*订单id*/
				order_id: 0,
				/*订单详情*/
				detail: {
					order_status: [],
					address: {
						region: []
					},
					product: [],
					pay_type: [],
					delivery_type: [],
					pay_status: []
				},

			}
		},
		onLoad(e) {
			this.order_id = e.order_id;
		},
		mounted() {
			uni.showLoading({
				title: '加载中'
			});
			/*获取订单详情*/
			this.getData();
		},
		methods: {
			/*获取订单详情*/
			getData() {
				let _this = this;
				let order_id = _this.order_id;
				_this._get(
					'user.order/paySuccess', {
						order_id: order_id
					},
					function(res) {
						_this.detail = res.data.order;
						_this.loadding = false;
						uni.hideLoading();
					}
				);
			},
			/*返回首页*/
			goHome() {
				this.gotoPage('/pages/index/index')
			},
			/*返回我的订单*/
			goMyorder() {
				this.gotoPage('/pages/order/myorder');
			}
		}
	}
</script>

<style lang="scss">
	.pay-success .success-icon {
		display: flex;
		padding: 70rpx 0 25rpx 0;
	}

	.pay-success .success-icon .iconfont {
		width: 98rpx;
		height: 98rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 50%;
		font-size: 60rpx;
	}

	.pay-success .success-icon .name {
		margin-top: 25rpx;
		font-size: 32rpx;
	}

	.pay-success .success-price {
		font-size: 36rpx;
	}

	.pay-success .success-price .num {
		font-size: 60rpx;
		font-weight: bold;
	}

	.pay-success .order-info {
		// background: #FFFFFF;
		padding: 0 44rpx;
	}

	.pay-success .success-btns {
		margin-top: 50rpx;
		padding: 30rpx;
	}

	.pay-success .success-btns button {
		font-size: 30rpx;
		border-radius: 72rpx;
	}

	.pay-success .success-btns button[type="default"] {
		border: 1px solid #04BE01;
		color: #04BE01;
	}
	.icon-jifen1.icon{
		font-size: 28rpx;
		margin-right: 20rpx;
	}
</style>